package com.example.project.controller;

import com.example.utils.upload.UploadUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @author gx
 * @date 2021/6/30 14:52
 */
@RestController
@Api("上传接口")
@RequestMapping("/uploadFileController")
public class UploadFileController {

    @ApiOperation("图片上传")
    @ResponseBody
    @PostMapping(value="/filesUpload",produces="application/json;charset=UTF-8")
    public String filesUpload(@RequestParam(value = "files" ) MultipartFile[] files, HttpServletRequest request) {
        String [] fileTypeArray = {".jpg",".gdf"};
        String uploadFolder = "D:/upload/picture";
        return UploadUtils.filesUpload(files,uploadFolder,fileTypeArray);
    }
}
